from django.db import models

class Clssukedi(models.Model):
    firstname = models.CharField(max_length=100)
    lastname = models.CharField(max_length=100)
    department = models.CharField(max_length=200)
    institute = models.CharField(max_length=200)
    city = models.CharField(max_length=100)
    email = models.CharField(max_length=150)
    abstract_title = models.CharField(max_length=150, blank=True) #abstract title
    abstract=models.TextField(blank=True)
    def __str__(self):
      return self.firstname
    class Meta:
        db_table = u'clssukedi'

class Promoter(models.Model):
    id = models.IntegerField(primary_key=True)
    mitid=models.CharField(max_length=15,blank=True)
    pname=models.CharField(max_length=25,blank=True)
    des = models.CharField(max_length=300,blank=True)
    tf = models.CharField(max_length=20,blank=True)
    function = models.CharField(max_length=2,blank=True)
    met = models.CharField(max_length=50,blank=True)
    catg = models.CharField(max_length=20,blank=True)
    length = models.CharField(max_length=20,blank=True)
    comment = models.CharField(max_length=200,blank=True)
    orgnaism = models.CharField(max_length=30,blank=True)
    TFid = models.CharField(max_length=20,blank=True) #tf gene id
    contributor = models.CharField(max_length=20,blank=True) #may link to another user account table
    def __str__(self):
      return self.mitid
    class Meta:
        db_table = u'promoter'
    class Admin:
        # Admin options go here
        list_display = ('id', 'mitid', 'tf', 'met',)
        ordering = ('mitid',)
        search_fields = ('mitid',)         

class Part(models.Model):
    mitid=models.CharField(max_length=15,primary_key=True)
    type=models.CharField(max_length=25)
    length = models.IntegerField()
    des=models.CharField(max_length=200)
    author=models.CharField(max_length=200,blank=True)
    group=models.CharField(max_length=100,blank=True) #registry group
    cluster1=models.IntegerField() #wc in network including all relations
    cluster2=models.IntegerField() #wc in network including similarity, same and extra sequence
    elementary=models.CharField(max_length=2)
    sequence = models.CharField(max_length=6000)
    def __str__(self):
      return self.mitid
    class Meta:
        db_table = u'part'
    class Admin:
        # Admin options go here
        list_display = ('mitid', 'type', 'length',)
        ordering = ('mitid',)
        search_fields = ('mitid',)         

class Part_link(models.Model):
    mitid1=models.ForeignKey(Part, related_name = "part1")
    mitid2=models.ForeignKey(Part, related_name = "part2")
    expect=models.CharField(max_length=15)
    matchbp=models.IntegerField()
    seq1s=models.IntegerField()
    seq2s=models.IntegerField()
    seq1e=models.IntegerField()
    seq2e=models.IntegerField()
    identity = models.FloatField()
    lendif = models.IntegerField()
    lendifper=models.FloatField()
    type=models.CharField(max_length=25,blank=True)
    redundant=models.CharField(max_length=5,blank=True)
    class Meta:
        db_table = u'part_link'
    class Admin:
        # Admin options go here
        list_display = ('mitid1', 'mitid2', 'identity',)

class Group(models.Model):
    gid = models.IntegerField(primary_key=True)
    nparts = models.IntegerField()
    function=models.CharField(max_length=200)
    def __str__(self):
      return self.gid
    class Meta:
        db_table = u'group'
    class Admin:
        # Admin options go here
        list_display = ('gid', 'nparts', 'function',)

class Stockuser(models.Model):
    uid = models.CharField(max_length=10, primary_key=True)
    stocks = models.CharField(max_length=1500)
    views=models.CharField(max_length=200)
    def __str__(self):
      return self.uid
    class Meta:
        db_table = u'stockuser'
        
